Skip to content

fix: reject unsupported database drivers in make:migration --session - #10546

Open
paulbalandan wants to merge 1 commit into
codeigniter4:developfrom
paulbalandan:session-migration-driver
Open

fix: reject unsupported database drivers in make:migration --session#10546
paulbalandan wants to merge 1 commit into
codeigniter4:developfrom
paulbalandan:session-migration-driver

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description

Discovered on #10545 . A smoke run of --session against a SQLite3 group produced a migration that cannot run, so this fixes the underlying bug on develop first.

make:migration --session renders the session table columns only for MySQLi and Postgre. For any other driver the template falls through and the command silently writes a migration that indexes a timestamp column it never defined:

$this->forge->addField([
    'id' => ['type' => 'VARCHAR', 'constraint' => 128, 'null' => false],
]);
$this->forge->addKey('id', true);
$this->forge->addKey('timestamp');
$this->forge->createTable('ci_sessions', true);

The user only finds out when spark migrate fails. The per-driver split is deliberate (8600032): DatabaseHandler writes timestamp with raw now(), so the column must be a real timestamp type, and the user guide already limits database sessions to MySQL and PostgreSQL. What was missing is a refusal for everything else.

The command now checks the group's DBDriver before generating and returns EXIT_ERROR with a message naming the group and driver. An undefined group is reported too instead of raising an undefined-property warning.

$ php spark make:migration --session --dbgroup tests
Database sessions are only supported on MySQLi and Postgre. The "tests" database group uses the "SQLite3" driver.

$ php spark make:migration --session --dbgroup bogus
The "bogus" database group is not defined.

New language strings: CLI.generator.undefinedDatabaseGroup and CLI.generator.unsupportedSessionDriver.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 12, 2026
@paulbalandan
paulbalandan force-pushed the session-migration-driver branch from 9dcca87 to 5c43b65 Compare September 12, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant